"""
条形图
案例：先以柱状图绘制苹果12个月的销量，然后再绘制橘子的销量
"""
import numpy as np
import matplotlib.pyplot as plt

apples = np.array([30, 25, 22, 36, 21, 29, 20, 24, 33, 19, 27, 15])
oranges = np.array([24, 33, 19, 27, 35, 20, 15, 27, 20, 32, 20, 22])
x = np.arange(1,13)

plt.figure("apples and oranges")
plt.title("apples and oranges",fontsize=20)

plt.bar(
    x-0.2,
    apples,
    0.3,
    color="red",
    alpha=0.8,
    label="apple"
)

plt.bar(
    x+0.1,
    oranges,
    0.3,
    color="orange",
    alpha=0.8,
    label="apple"
)

plt.legend()
plt.show()